﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/layuimini/lib/layui-v2.6.3/css/layui.css">
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
        }

        body {
            height: 100%;
        }

        .container {
            height: 100%;
            background-image: linear-gradient(to right, #2E8B57, #00FF7F);
        }

        .login-wrapper {
            background-color: #fff;
            width: 358px;
            height: 588px;
            border-radius: 15px;
            padding: 0 50px;
            position: relative;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        .header {
            font-size: 38px;
            font-weight: bold;
            text-align: center;
            line-height: 200px;
            color: #3CB371;
        }

        .input-item {
            display: block;
            width: 100%;
            margin-bottom: 20px;
            border: 0;
            padding: 10px;
            border-bottom: 1px solid rgb(128, 125, 125);
            font-size: 15px;
            outline: none;
        }

            .input-item:placeholder {
                text-transform: uppercase;
            }

        .btn {
            text-align: center;
            padding: 10px;
            width: 100%;
            margin-top: 40px;
            background-image: linear-gradient(to right, #2E8B57, #00FF7F);
            color: #fff;
        }

        .msg {
            text-align: center;
            line-height: 88px;
        }

        a {
            text-decoration-line: none;
            color: #abc1ee;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="login-wrapper">
            <div class="header">青橙酒店用户登录</div>
            <form class="layui-form login-bottom" method="post">
                <div class="form-wrapper">
                    <input type="text" name="username" placeholder="手机号码/身份证号" class="input-item">
                    <input type="password" name="password" placeholder="密码" class="input-item">
                    <button class="layui-btn layui-btn layui-btn-normal layui-btn-fluid" lay-submit lay-filter="login">登 入</button>
                </div>
            </form>
            <div class="msg">
                Don't have account?
                <a href="/home/zhuceye">Sign up</a>
            </div>
            <div class="msg">
                <a href="/home/Index">返回酒店首页</a>
            </div>
        </div>
    </div>
    <script src="/layuimini/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer;
            $ = layui.$;

        // 登录过期的时候，跳出ifram框架
        //if (top.location != self.location) top.location = self.location;

        // 进行登录操作
        form.on('submit(login)', function (data) {
            data = data.field;
            if (data.username == '') {
                layer.msg('用户名不能为空');
                return false;
            }
                //发起异步请求
            $.ajax({
                url:'/Account/login',
                type:"post",
                async:false,
                data:{
                    username:data.username,
                    password:data.password
                },
                success:function(res){
                    console.log(res)
                    if(res.isSuccess){
                        //保存用户信息
                        window.location.href = res.data;
                    }else{
                        layer.msg(res.msg);
                    }   
                }
            });

            return false;
        });
    });

    </script>
</body>
</html>